this.BX=this.BX||{};this.BX.Landing=this.BX.Landing||{};this.BX.Landing.UI=this.BX.Landing.UI||{};(function(e,t,n,i,o,r,a,l,s,u,d,c,g,p){"use strict";var f,h,v;function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b(Object(n),!0).forEach((function(t){babelHelpers.defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var L={removable:true,draggable:false,color:"blue"};var m=function(e){babelHelpers.inherits(t,e);function t(e){var n;babelHelpers.classCallCheck(this,t);n=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this));n.setEventNamespace("BX.Landing.UI.Field.RuleField.FieldElement");n.subscribeFromOptions(l.fetchEventsFromOptions(e));n.options=y(y({},L),e);n.cache=new r.Cache.MemoryCache;return n}babelHelpers.createClass(t,[{key:"getDragButtonLayout",value:function e(){return this.cache.remember("dragButton",(function(){var e=new s.IconButton({type:s.IconButton.Types.drag,style:{width:"20px"}});return e.getLayout()}))}},{key:"getActionsDropdown",value:function e(){var t=this;return this.cache.remember("actionsDropdown",(function(){var e=new window.top.BX.Landing.UI.Field.DropdownInline({title:t.options.actionsLabel,items:t.options.actionsList,content:t.options.actionsValue});e.subscribe("onChange",(function(){t.emit("onChange")}));return e}))}},{key:"getActionsLayout",value:function e(){var t=this;return this.cache.remember("actionsLayout",(function(){return r.Tag.render(f||(f=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-field-element-text-action">\n\t\t\t\t\t',"\n\t\t\t\t</div>\n\t\t\t"])),t.getActionsDropdown().getLayout())}))}},{key:"getTitleLayout",value:function e(){var t=this;return this.cache.remember("titleLayout",(function(){return r.Tag.render(h||(h=babelHelpers.taggedTemplateLiteral(['<div class="landing-ui-field-element-text-title">',"</div>"])),t.options.title)}))}},{key:"getRemoveButtonLayout",value:function e(){var t=this;return this.cache.remember("removeButton",(function(){var e=new s.IconButton({type:s.IconButton.Types.remove,onClick:function e(){return t.emit("onRemove")},iconSize:"9px",style:{width:"20px",marginLeft:"auto"}});return e.getLayout()}))}},{key:"getLayout",value:function e(){var t=this;return this.cache.remember("layout",(function(){return r.Tag.render(v||(v=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-field-element-','">\n\t\t\t\t\t','\n\t\t\t\t\t<div class="landing-ui-field-element-text">\n\t\t\t\t\t\t',"\n\t\t\t\t\t\t","\n\t\t\t\t\t</div>\n\t\t\t\t\t","\n\t\t\t\t</div>\n\t\t\t"])),t.options.color,t.options.draggable?t.getDragButtonLayout():"",t.options.actionsLabel?t.getActionsLayout():"",t.getTitleLayout(),t.options.removable?t.getRemoveButtonLayout():"")}))}}]);return t}(a.EventEmitter);babelHelpers.defineProperty(m,"Colors",{blue:"blue",green:"green",red:"red"});var C,E,O,D,I,k,T,F,_,w;function N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?N(Object(n),!0).forEach((function(t){babelHelpers.defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var R=function(e){babelHelpers.inherits(t,e);function t(e){var n;babelHelpers.classCallCheck(this,t);n=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this));n.setEventNamespace("BX.Landing.UI.Field.RuleField.RuleEntry");n.subscribeFromOptions(l.fetchEventsFromOptions(e));n.options=x({},e);n.cache=new r.Cache.MemoryCache;n.draggable=new d.Draggable({container:n.getExpressionContainer(),dragElement:".landing-ui-button-icon-drag",draggable:".landing-ui-field-element-green",type:d.Draggable.HEADLESS,context:window.parent,offset:{y:-62}});n.draggable.subscribe("end",n.onDragEnd.bind(babelHelpers.assertThisInitialized(n)));n.state={condition:{field:n.options.condition.field.id,value:n.options.condition.value,operator:n.options.condition.operator},expression:n.options.expression.map((function(e){return{field:e.field.id,action:e.action}}))};n.options.expression.forEach((function(e){n.addExpressionItem({id:e.field.id,label:e.field.label,action:e.action,preventEvent:true})}));return n}babelHelpers.createClass(t,[{key:"getOperatorField",value:function e(){var t=this;return this.cache.remember("operatorField",(function(){var e=t.options.dictionary.deps.condition;return new BX.Landing.UI.Field.Radio({selector:"operator",value:[t.state.condition.operator],items:e.operations.filter((function(e){return!r.Type.isArrayFilled(e.fieldTypes)||e.fieldTypes.includes(t.options.condition.field.type)})).map((function(e){return{name:e.name,value:e.id}})),onChange:t.onOperatorChange.bind(t)})}))}},{key:"getOperatorLabel",value:function e(t){var n=this.getOperatorField();return n.items.reduce((function(e,n){return String(n.value)===String(t)?n.name:e}),"")}},{key:"onOperatorChange",value:function e(){var t=this.getOperatorField();var n=t.getValue(),i=babelHelpers.slicedToArray(n,1),o=i[0];this.getOperatorLabelLayout().textContent=this.getOperatorLabel(o);this.state.condition.operator=o;this.emit("onChange")}},{key:"getSeparator",value:function e(){return this.cache.remember("separator",(function(){return r.Tag.render(C||(C=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="value-settings-item-separator"></div>\n\t\t\t'])))}))}},{key:"renderValueRadioButton",value:function e(t){var n=this;var i=t.label,o=t.value,a=t.id,l=t.checked;var s=function e(){n.setValueLabelText(i);n.state.condition.value=o;n.emit("onChange")};return r.Tag.render(E||(E=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="value-settings-item value-settings-item-value">\n\t\t\t\t<input \n\t\t\t\t\ttype="radio" \n\t\t\t\t\tid="value_',"_",'" \n\t\t\t\t\tname="value_',"_",'"\n\t\t\t\t\tonchange="','"\n\t\t\t\t\t','\n\t\t\t\t>\n\t\t\t\t<label for="value_',"_",'">',"</label>\n\t\t\t</div>\n\t\t"])),a,o,a,this.options.condition.field.id,s,l?"checked":"",a,o,i)}},{key:"getValueSettingsPopup",value:function e(){var t=this;return this.cache.remember("valueSettingsPopup",(function(){var e=c.PageObject.getRootWindow();var n=r.Tag.render(O||(O=babelHelpers.taggedTemplateLiteral(['<div class="value-settings-popup"></div>'])));var i=r.Text.getRandom();if(t.options.condition.field.type==="list"||t.options.condition.field.type==="checkbox"||t.options.condition.field.type==="radio"||t.options.condition.field.type==="bool"){var o=t.getOperatorField();o.setValue(t.options.condition.operator);r.Dom.append(o.getLayout(),n);r.Dom.append(t.getSeparator(),n);var a=function(){if(t.options.condition.field.type==="bool"){return[{label:u.Loc.getMessage("LANDING_RULE_FIELD_CONDITION_VALUE_YES"),value:"Y"},{label:u.Loc.getMessage("LANDING_RULE_FIELD_CONDITION_VALUE_NO"),value:"N"}]}return t.options.condition.field.items}();a.forEach((function(e){var o=String(t.options.condition.value)===String(e.value);r.Dom.append(r.Dom.append(t.renderValueRadioButton(x(x({},e),{},{id:i,checked:o})),n),n)}))}else{var l=t.getOperatorField();l.setValue(t.options.condition.operator);r.Dom.append(l.getLayout(),n);r.Dom.append(t.getSeparator(),n);var s=new g.TextField({textOnly:true,onValueChange:function e(){var n=s.getValue()||u.Loc.getMessage("LANDING_RULE_FIELD_CONDITION_VALUE_EMPTY");t.setValueLabelText(n);t.state.condition.value=s.getValue();t.emit("onChange")},content:t.options.condition.value});r.Dom.append(s.getLayout(),n)}return new e.BX.Main.Popup({bindElement:t.getConditionValueLayout(),content:n,width:228,autoHide:true,offsetLeft:8,offsetTop:1,maxHeight:200,events:{onShow:function e(){r.Dom.addClass(t.getConditionValueLayout(),"landing-ui-rule-entry-condition-value-active");t.getValueSettingsPopup().adjustPosition({forceBindPosition:true})},onClose:function e(){r.Dom.removeClass(t.getConditionValueLayout(),"landing-ui-rule-entry-condition-value-active")}}})}))}},{key:"getOperatorLabelLayout",value:function e(){var t=this;return this.cache.remember("operatorLayout",(function(){return r.Tag.render(D||(D=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-rule-entry-condition-value-operator">\n\t\t\t\t\t',"\n\t\t\t\t</div>\n\t\t\t"])),t.getOperatorLabel(t.options.condition.operator))}))}},{key:"getValueLabel",value:function e(){var t=this;if(r.Type.isArray(this.options.condition.field.items)){var n=this.options.condition.field.items.find((function(e){return String(e.value)===String(t.options.condition.value)}));if(n&&r.Type.isString(n.label)){return n.label}}if(r.Type.isStringFilled(this.options.condition.value)){if(this.options.condition.value==="Y"){return u.Loc.getMessage("LANDING_RULE_FIELD_CONDITION_VALUE_YES")}if(this.options.condition.value==="N"){return u.Loc.getMessage("LANDING_RULE_FIELD_CONDITION_VALUE_NO")}return this.options.condition.value}return u.Loc.getMessage("LANDING_RULE_FIELD_CONDITION_VALUE_EMPTY")}},{key:"getValueLabelLayout",value:function e(){var t=this;return this.cache.remember("valueLabelLayout",(function(){return r.Tag.render(I||(I=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div \n\t\t\t\t\tclass="landing-ui-rule-entry-condition-value-value-label"\n\t\t\t\t\tonclick="','"\n\t\t\t\t>\n\t\t\t\t\t',"\n\t\t\t\t</div>\t\t\t\n\t\t\t"])),t.onValueLabelClick.bind(t),t.getValueLabel())}))}},{key:"setValueLabelText",value:function e(t){this.getValueLabelLayout().textContent=t}},{key:"onValueLabelClick",value:function e(t){t.preventDefault();var n=this.getValueSettingsPopup();if(!n.isShown()){n.show()}else{n.close()}}},{key:"getConditionValueLayout",value:function e(){var t=this;return this.cache.remember("conditionValueLayout",(function(){return r.Tag.render(k||(k=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-rule-entry-condition-value">\n\t\t\t\t\t<div class="landing-ui-rule-entry-condition-value-text">\n\t\t\t\t\t\t',"\n\t\t\t\t\t\t","\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t"])),t.getOperatorLabelLayout(),t.getValueLabelLayout())}))}},{key:"getConditionContainer",value:function e(){var t=this;return this.cache.remember("conditionContainer",(function(){return r.Tag.render(T||(T=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-rule-entry-condition">\n\t\t\t\t\t',"\n\t\t\t\t</div>\n\t\t\t"])),t.getConditionValueLayout())}))}},{key:"getFieldsListMenu",value:function e(){var t=this;return this.cache.remember("fieldsListMenu",(function(){return new window.top.BX.Main.Menu({bindElement:t.getAddFieldLink(),maxHeight:205,items:t.options.fieldsList.filter((function(e){return e.type!=="page"&&e.type!=="layout"&&e.id!==t.options.condition.field.id})).map((function(e){return{id:e.id,text:e.label,onclick:t.onAddExpressionField.bind(t,e)}}))})}))}},{key:"onExpressionItemRemove",value:function e(t){var n=t.getTarget();r.Dom.remove(n.getLayout());if(this.getExpressionContainer().children.length===1){r.Dom.removeClass(this.getLayout(),"landing-ui-rule-entry-with-expression")}this.state.expression=this.state.expression.filter((function(e){return e.field!==n.options.id}));this.emit("onChange")}},{key:"onExpressionFieldChange",value:function e(t){var n=t.getTarget();var i=this.state.expression.find((function(e){return e.field===n.options.id}));if(i){i.action=n.getActionsDropdown().getValue()}this.emit("onChange")}},{key:"addExpressionItem",value:function e(t){var n=x({preventEvent:false,action:"show"},t);var i=new m({id:n.id,title:n.label,removable:true,color:m.Colors.green,actionsLabel:u.Loc.getMessage("LANDING_RULE_FIELD_CONDITION_FIELD_ACTION_LABEL"),actionsList:[{name:u.Loc.getMessage("LANDING_RULE_FIELD_CONDITION_FIELD_ACTION_SHOW_LABEL"),value:"show"},{name:u.Loc.getMessage("LANDING_RULE_FIELD_CONDITION_FIELD_ACTION_HIDE_LABEL"),value:"hide"}],actionsValue:n.action,onRemove:this.onExpressionItemRemove.bind(this),onChange:this.onExpressionFieldChange.bind(this)});r.Dom.insertBefore(i.getLayout(),this.getAddFieldLink());this.state.expression.push({field:n.id,action:"show"});this.state.expression=this.state.expression.reduce((function(e,t){if(!e.find((function(e){return e.field===t.field}))){e.push(t)}return e}),[]);this.adjustExpressionItems();r.Dom.addClass(this.getLayout(),"landing-ui-rule-entry-with-expression");if(!n.preventEvent){this.emit("onChange")}}},{key:"onAddExpressionField",value:function e(t){this.addExpressionItem(t);this.getFieldsListMenu().close()}},{key:"adjustExpressionItems",value:function e(){babelHelpers.toConsumableArray(this.getExpressionContainer().children).reverse().forEach((function(e,t){if(!r.Dom.hasClass(e,"landing-ui-rule-entry-expression-link")){r.Dom.style(e,"z-index",t+2)}}))}},{key:"onAddFieldLinkClick",value:function e(t){t.preventDefault();var n=this.getFieldsListMenu();var i=this.state.expression;n.getMenuItems().forEach((function(e){var t=i.some((function(t){return t.field===e.getId()}));if(t){r.Dom.addClass(e.getLayout().item,"landing-ui-disabled")}else{r.Dom.removeClass(e.getLayout().item,"landing-ui-disabled")}}));this.getFieldsListMenu().show()}},{key:"getAddFieldLink",value:function e(){var t=this;return this.cache.remember("addFieldLink",(function(){return r.Tag.render(F||(F=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-rule-entry-expression-link">\n\t\t\t\t\t<div \n\t\t\t\t\t\tclass="landing-ui-rule-entry-expression-link-text"\n\t\t\t\t\t\tonclick="','"\n\t\t\t\t\t>\n\t\t\t\t\t\t','\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="landing-ui-rule-entry-expression-link-sep"></div>\n\t\t\t\t</div>\n\t\t\t'])),t.onAddFieldLinkClick.bind(t),u.Loc.getMessage("LANDING_RULE_FIELD_EXPRESSION_ADD_FIELD_LINK_LABEL"))}))}},{key:"getExpressionContainer",value:function e(){var t=this;return this.cache.remember("expressionContainer",(function(){return r.Tag.render(_||(_=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-rule-entry-expression">\n\t\t\t\t\t',"\n\t\t\t\t</div>\n\t\t\t"])),t.getAddFieldLink())}))}},{key:"getLayout",value:function e(){var t=this;return this.cache.remember("layout",(function(){return r.Tag.render(w||(w=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-rule-entry">\n\t\t\t\t\t',"\n\t\t\t\t\t","\n\t\t\t\t</div>\n\t\t\t"])),t.getConditionContainer(),t.getExpressionContainer())}))}},{key:"getValue",value:function e(){return this.state}},{key:"onDragEnd",value:function e(){this.adjustExpressionItems();this.emit("onChange")}}]);return t}(a.EventEmitter);var H,A,B;function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function j(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P(Object(n),!0).forEach((function(t){babelHelpers.defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var V=function(e){babelHelpers.inherits(t,e);function t(){var e;var n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,t);e=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this));e.setEventNamespace("BX.Landing.UI.Field.RuleField.FieldRow");e.options=j({},n);e.cache=new r.Cache.MemoryCache;e.entries=[];e.onEntryChange=e.onEntryChange.bind(babelHelpers.assertThisInitialized(e));e.addRule(e.options);return e}babelHelpers.createClass(t,[{key:"addRule",value:function e(t){var n=new R(j(j({},t),{},{fieldsList:this.options.fields,dictionary:this.options.dictionary}));this.entries.push(n);n.subscribe("onChange",this.onEntryChange);r.Dom.append(n.getLayout(),this.getListContainer());this.emit("onChange")}},{key:"onEntryChange",value:function e(){this.emit("onChange")}},{key:"getConditionFieldLayout",value:function e(){var t=this;return this.cache.remember("conditionField",(function(){var e=new m({title:t.options.condition.field.label,removable:true,onRemove:t.onConditionFieldRemoveClick.bind(t)});return e.getLayout()}))}},{key:"onConditionFieldRemoveClick",value:function e(t){t.preventDefault();r.Dom.remove(this.getLayout());this.entries=[];this.emit("onChange")}},{key:"getFieldContainer",value:function e(){var t=this;return this.cache.remember("fieldContainer",(function(){return r.Tag.render(H||(H=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-field-rule-field-row-field-container">\n\t\t\t\t\t<div class="landing-ui-field-rule-field-row-field-container-title">\n\t\t\t\t\t\t',"\n\t\t\t\t\t</div>\n\t\t\t\t\t",'\n\t\t\t\t\t<div class="landing-ui-field-rule-field-row-field-container-action-title">\n\t\t\t\t\t\t',"\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t"])),u.Loc.getMessage("LANDING_RULE_FIELD_CONDITION_FIELD_TITLE"),t.getConditionFieldLayout(),u.Loc.getMessage("LANDING_RULE_FIELD_CONDITION_FIELD_SHOW_ACTION_TITLE"))}))}},{key:"getListContainer",value:function e(){return this.cache.remember("listContainer",(function(){return r.Tag.render(A||(A=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-field-rule-field-row-list"></div>\n\t\t\t'])))}))}},{key:"getLayout",value:function e(){var t=this;return this.cache.remember("layout",(function(){return r.Tag.render(B||(B=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-field-rule-field-row">\n\t\t\t\t\t',"\n\t\t\t\t\t","\n\t\t\t\t</div>\n\t\t\t"])),t.getFieldContainer(),t.getListContainer())}))}},{key:"getValue",value:function e(){return this.entries.map((function(e){return e.getValue()}))}}]);return t}(a.EventEmitter);var S,M,U,X;function G(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?G(Object(n),!0).forEach((function(t){babelHelpers.defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):G(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var z=function(e){babelHelpers.inherits(t,e);function t(e){var n;babelHelpers.classCallCheck(this,t);n=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e));n.setEventNamespace("BX.Landing.UI.Field.RuleField");n.subscribeFromOptions(l.fetchEventsFromOptions(e));n.setLayoutClass("landing-ui-field-rule");n.onRemoveClick=n.onRemoveClick.bind(babelHelpers.assertThisInitialized(n));n.onRowChange=n.onRowChange.bind(babelHelpers.assertThisInitialized(n));r.Dom.clean(n.layout);r.Dom.append(n.getHeaderLayout(),n.getLayout());r.Dom.append(n.getBodyLayout(),n.getLayout());r.Dom.append(n.getFooterLayout(),n.getLayout());n.setRuleType(n.options.type);n.rows=[];n.options.rules.forEach((function(e){n.addRule(e)}));if(n.hasExpression()){n.hideExpressionsLabel()}return n}babelHelpers.createClass(t,[{key:"hideExpressionsLabel",value:function e(){r.Dom.hide(this.rows[0].getFieldContainer().querySelector(".landing-ui-field-rule-field-row-field-container-action-title"))}},{key:"hasExpression",value:function e(){return this.options.rules.some((function(e){return e.expression.length>0}))}},{key:"setRuleType",value:function e(t){this.cache.set("ruleType",t)}},{key:"getRuleType",value:function e(){return this.cache.get("ruleType")}},{key:"addRule",value:function e(t){var n=new V(Y(Y({},t),{},{fields:this.options.fields,dictionary:this.options.dictionary}));this.rows.push(n);n.subscribe("onChange",this.onRowChange);r.Dom.append(n.getLayout(),this.getBodyLayout());this.emit("onChange")}},{key:"onRowChange",value:function e(t){this.emit("onChange");var n=t.getTarget().getValue().some((function(e){return e.expression.length>0}));var i=this.rows[0].getFieldContainer().querySelector(".landing-ui-field-rule-field-row-field-container-action-title");if(n){r.Dom.hide(i)}else{r.Dom.show(i)}}},{key:"getHeaderTitleLayout",value:function e(){return this.cache.remember("headerTitleLayout",(function(){return r.Tag.render(S||(S=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-field-rule-header-title">',"</div>\n\t\t\t"])),u.Loc.getMessage("LANDING_FIELDS_RULES_TYPE_1"))}))}},{key:"getRemoveButtonLayout",value:function e(){var t=this;return this.cache.remember("removeButtonLayout",(function(){var e=new s.IconButton({type:s.IconButton.Types.remove,onClick:t.onRemoveClick,title:u.Loc.getMessage("LANDING_RULE_FIELD_REMOVE_BUTTON_TITLE"),style:{marginLeft:"auto"}});return e.getLayout()}))}},{key:"getHeaderLayout",value:function e(){var t=this;return this.cache.remember("headerLayout",(function(){return r.Tag.render(M||(M=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-field-rule-header">\n\t\t\t\t\t',"\n\t\t\t\t\t","\n\t\t\t\t</div>\n\t\t\t"])),t.getHeaderTitleLayout(),t.getRemoveButtonLayout())}))}},{key:"getBodyLayout",value:function e(){return this.cache.remember("bodyLayout",(function(){return r.Tag.render(U||(U=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-field-rule-body"></div>\n\t\t\t'])))}))}},{key:"getFooterLayout",value:function e(){var t=this;return this.cache.remember("footerLayout",(function(){return r.Tag.render(X||(X=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-field-rule-footer">\n\t\t\t\t\t',"\n\t\t\t\t</div>\n\t\t\t"])),t.getFooterActionPanel().getLayout())}))}},{key:"onRemoveClick",value:function e(t){t.preventDefault();r.Dom.remove(this.getLayout());this.emit("onRemove");this.emit("onChange")}},{key:"getFooterActionPanel",value:function e(){var t=this;return this.cache.remember("footerActionPanel",(function(){return new i.ActionPanel({left:[{id:"selectField",text:u.Loc.getMessage("LANDING_RULE_FIELD_EXPRESSION_ADD_FIELD_LINK_LABEL"),onClick:t.onAddFieldRulesLinkClick.bind(t)}]})}))}},{key:"getFieldsListMenu",value:function e(){var t=this;return this.cache.remember("fieldsMenu",(function(){return new window.top.BX.Main.Menu({bindElement:t.getFooterActionPanel().getLeftContainer().firstElementChild,maxHeight:205,items:t.options.fields.map((function(e){return{id:e.id,text:e.label,onclick:function n(){t.onAddFieldRulesMenuItemClick(e)}}})),autoHide:true})}))}},{key:"onAddFieldRulesLinkClick",value:function e(){this.getFieldsListMenu().show()}},{key:"onAddFieldRulesMenuItemClick",value:function e(t){this.addRule({condition:{field:t,value:"",operator:"="},expression:[]});this.getFieldsListMenu().close()}},{key:"getValue",value:function e(){return this.rows.map((function(e){return e.getValue()}))}}]);return t}(n.BaseField);e.RuleField=z})(this.BX.Landing.UI.Field=this.BX.Landing.UI.Field||{},BX,BX.Landing.UI.Field,BX.Landing.UI.Component,BX,BX,BX.Event,BX.Landing.UI.Component,BX.Landing.UI.Component,BX.Landing,BX.UI.DragAndDrop,BX.Landing,BX.Landing.UI.Field,BX.Main);
//# sourceMappingURL=rulefield.bundle.map.js